package com.evil.application.api;

import com.evil.application.config.FeignErrorDecoder;
import com.evil.application.pojo.dto.ReorderApplicationReqDTO;
import com.evil.application.pojo.dto.pack.*;
import com.evil.common.core.constant.ServiceNameConstant;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;


/**
 * 应用包接口
 *
 * @author liyang
 * @date 2022-08-08 00:00
 */
@FeignClient(name = ServiceNameConstant.APPLICATION_SERVICE, configuration = {FeignErrorDecoder.class})
public interface RemoteApplicationPackageService {

    /**
     * 获取应用包基础信息
     *
     * @param packageId 应用包id
     * @return PackageBaseInfoRespDTO
     */
    @PostMapping("/remote/application/package/base-info")
    PackageBaseInfoRespDTO packageBaseInfo(@RequestParam("packageId") Long packageId);

    /**
     * 获取应用包信息
     *
     * @param packageAppListInfoReqDTO packageAppListInfoReqDTO
     * @return PackageBaseInfoRespDTO
     */
    @PostMapping("/remote/application/package/info")
    PackageInfoRespDTO packageInfo(@Validated @RequestBody PackageAppListInfoReqDTO packageAppListInfoReqDTO);

    /**
     * 获取应用包列表
     *
     * @param packageListReqDTO packageListReqDTO
     * @return PackageRespDTO 列表
     */
    @PostMapping("/remote/application/package/list")
    List<PackageRespDTO> packageList(@Validated @RequestBody PackageListReqDTO packageListReqDTO);

    /**
     * 新增应用包
     *
     * @param addPackageReqDTO addPackageReqDTO
     */
    @PostMapping("/remote/application/package/add")
    void addPackage(@Validated @RequestBody AddPackageReqDTO addPackageReqDTO);

    /**
     * 重新排序应用包
     *
     * @param packageIds packageIds
     */
    @PostMapping("/remote/application/package/reorder")
    void reorderPackage(@RequestParam("packageIds") List<Long> packageIds);

    /**
     * 编辑应用包
     *
     * @param modifyPackageReqDTO modifyPackageReqDTO
     */
    @PostMapping("/remote/application/package/modify")
    void modifyPackage(@Validated @RequestBody ModifyPackageReqDTO modifyPackageReqDTO);

    /**
     * 删除应用包
     *
     * @param deletePackageReqDTO deletePackageReqDTO
     */
    @PostMapping("/remote/application/package/delete")
    void deletePackage(@Validated @RequestBody DeletePackageReqDTO deletePackageReqDTO);

    /**
     * 重新排序应用包应用
     *
     * @param reorderApplicationReqDTO reorderApplicationReqDTO
     */
    @PostMapping("/remote/application/package/item/reorder")
    void reorderApplication(@Validated @RequestBody ReorderApplicationReqDTO reorderApplicationReqDTO);
}
